package com.tyf.common.vo;

import java.util.Map;

/**
 * 
 * Description: 多表保存-请求接口
 * author:      liutao
 * Createdate:  2016年4月6日上午10:57:45
 */
public class MultiSaveRequest<M>{
	
	/**
	 * 操作类型	@see CommonOperatorEnum
	 */
	private String opType;
	
	/**
	 * 主表从表关联字段
	 */
	private String idName;
	
	/**
	 * 单据类型
	 */
	private String billType;
	
	/**
	 * 主表
	 */
	private M  master;
	
	/**
	 * 明细表-为json字符串
	 */
	private Map<String, SimpleSaveRequest<?>> details;

	public String getOpType() {
		return opType;
	}

	public void setOpType(String opType) {
		this.opType = opType;
	}

	public String getIdName() {
		return idName;
	}

	public void setIdName(String idName) {
		this.idName = idName;
	}

	public M getMaster() {
		return master;
	}

	public void setMaster(M master) {
		this.master = master;
	}

	public Map<String, SimpleSaveRequest<?>> getDetails() {
		return details;
	}

	public void setDetails(Map<String, SimpleSaveRequest<?>> details) {
		this.details = details;
	}

	public String getBillType() {
		return billType;
	}

	public void setBillType(String billType) {
		this.billType = billType;
	}

	public static <T> MultiSaveRequest<T> newMultiSaveRequest(){
		MultiSaveRequest<T> m = new MultiSaveRequest<T>();
		m.setBillType("110110");
		m.setIdName("billNo");
		m.setOpType("inserted");
		
		return m;
	}
	
}
